package com.github.llyb120.workflow.entity;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ActionEnum {

    final public static int ACTION_SAVE = 0x01;
    final public static int ACTION_PUBLISH = 0x01<<1;
    final public static int ACTION_SUBMIT = 0x01<<2;
    final public static int ACTION_MAIN_WRITE_NODE = 0x01<<3;
    final public static int ACTION_SUPPORT_WRITE_NODE = 0x01<<4;


    static Map<Integer, String> cache = new ConcurrentHashMap<>();
    static {
        try {
            for (Field field : ActionEnum.class.getDeclaredFields()) {
                if (field.getType() == int.class) {
                    cache.put((Integer) field.get(null), field.getName());
                }
            }
        } catch (Throwable e){}
    }

    public static String getValue(int original){
        return cache.get(original);
    }
}
